'use strict';

/* Controllers */
app.controller('testListCtl', function($scope,$http,rest,$compile,$location,ngDialog,user,$state,$window,uiLoad,$rootScope,$ocLazyLoad) {

    console.log(rest);

            rest.java({
                url: '/decorate-service/decorate/api/service/getCreditLine.json',
                data: {
                    originalId: user.get('openId')
                },
                success: function (data) {
                    console.log(data);
                }
            });

    $scope.dataTableASettings = {
        "dom": "tpr",
        "sAjaxSource": "4008",
        "sScrollY": "auto",
        "sPaginationType": "simple",
        "aoColumns": [
            {
                "sWidth": "30%",
                "bSortable": false,
                "mDataProp": "areaName",
                "sTitle": "小区名称",
                "sDefaultContent": "",
                "sClass": "center",
            }, {
                "sWidth": "30%",
                "bSortable": false,
                "mDataProp": "roomCode",
                "sTitle": "房间号",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "sWidth": "40%",
                "bSortable": false,
                "mDataProp": "createDate",
                "sTitle": "创建时间",
                "sDefaultContent": "",
                "sClass": "center"
            }
        ],
        "fnRowCallback": function(nRow, aData, iDisplayIndex) {

        },
        "fnDrawCallback": function(oSettings) {

        },
        "fnServerParams": function(aoData) {

        }
    }

    $scope.dataTableBSettings = {
        "dom": "tpr",
        "sAjaxSource": "4008",
        "sScrollY": "auto",
        "sPaginationType": "simple",
        "aoColumns": [
            {
                "sWidth": "30%",
                "bSortable": false,
                "mDataProp": "areaName",
                "sTitle": "小区名称",
                "sDefaultContent": "",
                "sClass": "center",
            }, {
                "sWidth": "30%",
                "bSortable": false,
                "mDataProp": "cityName",
                "sTitle": "城市",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "sWidth": "40%",
                "bSortable": false,
                "mDataProp": "createDate",
                "sTitle": "创建时间",
                "sDefaultContent": "",
                "sClass": "center"
            }
        ],
        "fnRowCallback": function(nRow, aData, iDisplayIndex) {

        },
        "fnDrawCallback": function(oSettings) {

        },
        "fnServerParams": function(aoData) {

        }
    }


    $scope.dataListSettings = {
        "dom": "tir",
        "sAjaxSource": "4008",
        "aoColumns": [
            {
                "mDataProp": "areaName",
                "sTitle": "小区名称",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "roomCode",
                "sTitle": "房间号",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "createDate",
                "sTitle": "创建时间",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "operate",
                "sTitle": "操作",
                "sDefaultContent": "",
                "sClass": "center handle-td operation"
            }
        ],
        "fnRowCallback": function(nRow, aData, iDisplayIndex) {

        },
        "fnDrawCallback": function(oSettings) {

        },
        "fnServerParams": function(aoData) {

        }
    }


    $scope.initTableAFinish = function(dataTable) {
         $scope.dataTableA = dataTable;
    }
    $scope.initTableBFinish = function(dataTable) {
         $scope.dataTableB = dataTable;
    }
    $scope.initListFinish = function(dataTable) {
         $scope.dataList = dataTable;
    }

    $scope.tab = 1;

    $scope.setTab = function(newTab){
      $scope.tab = newTab;
    };

    $scope.isSet = function(tabNum){
      return $scope.tab === tabNum;
    };    
});
